package com.honestpeak.datafusion.service.impl;

import java.util.Date;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.honestpeak.core.utils.WebUtils;
import com.honestpeak.datafusion.mapper.ClubCoursePlaceMapper;
import com.honestpeak.datafusion.model.ClubCoursePlace;
import com.honestpeak.datafusion.model.ClubMemberDist;
import com.honestpeak.datafusion.service.ClubCoursePlaceService;

@Service
public class ClubCoursePlaceServiceImpl implements ClubCoursePlaceService{

	@Resource
	private ClubCoursePlaceMapper clubCoursePlaceMapper;
	
	@Override
	public Map<String, Object> getClubCoursePlace(String week, String dataDuan) {
		Map<String, Object> resultMap = Maps.newHashMap();
        List<Map<String, Object>> itemsList = Lists.newArrayList();
        List<ClubCoursePlace> clubMemberDistsList = clubCoursePlaceMapper.getClubCoursePlace(week,dataDuan);
        clubMemberDistsList.stream().forEach(
                x -> {
                    Map<String, Object> map = Maps.newHashMap();
                    map.put("courseName", x.getCourseName());
                    map.put("courseCampus", x.getCourseCampus());
                    map.put("coursePlace", x.getCoursePlace());
                    map.put("lat", x.getLat());
                    map.put("lng", x.getLng());
                    map.put("teacher", x.getTeacher());
                    map.put("peopleNum", x.getPeopleNum());
                    itemsList.add(map);
                }
        );
        resultMap.put("items", itemsList);
        return resultMap;
	}


}
